﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ADV_Evaluator;
using ADV_Evaluator.Command;

namespace ADV_Editor.CommandDialog
{
	partial class DeleteClickableMapDialog : CommandDialogBase
	{
		/// <summary>
		/// 初期値を指定しないコンストラクタ
		/// </summary>
		public DeleteClickableMapDialog()
		{
			// コンポーネントの初期化
			InitializeComponent();
		}

		/// <summary>
        /// 初期値を指定したコンストラクタ
        /// </summary>
        /// <param name="param">属性</param>
		public DeleteClickableMapDialog(DeleteClickableMapParams param)
			: this()
        {
            switch (param.Mode) {
            case DeleteClickableMapMode.Single:
                this.radSimple.Checked = true; break;
            case DeleteClickableMapMode.All:
                this.radAll.Checked = true; break;
            }
			this.txtLabel.Text = param.Label;
		}

		/// <summary>
		/// 設定された画像をコマンド化したもの
		/// </summary>
		public override CommandListData Command
		{
            get
            {
                // 属性
                DeleteClickableMapParams param = new DeleteClickableMapParams();
                param.Label = this.txtLabel.Text;
                if (this.radSimple.Checked) { param.Mode = DeleteClickableMapMode.Single; }
                if (this.radAll.Checked) { param.Mode = DeleteClickableMapMode.All; } 
                return new CommandListData(CommandName.クリッカブル領域の削除, param);
            }
		}

        private void radSimple_CheckedChanged(object sender, EventArgs e)
        {
            if (this.radSimple.Checked) { 
                this.txtLabel.Enabled = true; 
                this.txtLabel.Text = string.Empty; 
            }
            if (this.radAll.Checked) { 
                this.txtLabel.Enabled = false; 
                this.txtLabel.Text = string.Empty; 
            }
        }
	}
}
